<template>
  <div class="groupbody">
    <div class="assemble-item">
      <div class="assemble-shop-item fx" v-for="(item, i) in info.banner" :key="i">
        <img :src="$fnc.getImgUrl(item.piclink)" alt="" />
        <div>
          <p>{{ item.title }}</p>
          <div class="fx group-price">
            <span>{{ item.group_people || "xx" }}人成团</span>
            <span v-if="item.group_face == 1">团长免单</span>
          </div>
          <div>
            <div>
              <p>
                团后价：<span><small>￥</small>{{ item.group_price || "xx" }}</span>
              </p>
              <span>马上抢</span>
            </div>
            <div>
              <p>
                原价：<span><small>￥</small>{{ item.price || "xx" }}</span>
              </p>
              <p>{{ item.real_sale || 0 }}人已经拼团成功</p>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>
<script>
export default {
  data () {
    return {};
  },
  props: {
    info: {
      type: Object,
      default: () => ({})
    }
  },
  components: {},
  methods: {
    get_int_dec (num, type) {
      // @type  int-整数部分 ,dec - 小数部分
      num = num + "";
      num = num.toString();
      var decimal = 2;
      decimal = decimal >= 2 && decimal < 6 ? 2 : decimal;
      decimal = decimal == "0" ? 0 : decimal || 2;
      let index = num.indexOf(".");
      if (index !== -1) {
        num = num.substring(0, decimal + index + 1);
      } else {
        num = num.substring(0);
      }
      num = parseFloat(num).toFixed(decimal);
      if (type == "int") {
        return parseInt(num);
      } else if (type == "dec") {
        return "." + num.toString().split(".")[1] || ".00";
      }
    }
  }
};
</script>
<style lang="less" scoped>
.groupbody {
  width: 94%;
  margin: 0 auto;
}
.assemble-item {
  // padding: 13px 10px 17px;
  > div:not(:first-child) {
    margin-top: 10px;
  }
}
.assemble-shop-item {
  font-size: 14px;
  line-height: 1.2;
  background: #fff;
  border-radius: 5px;
  overflow: hidden;
  justify-content: flex-start;
  align-items: center;
  // padding: 0 10px;
  > img {
    width: 125px;
    height: 125px;
    margin-right: 5px;
  }
  > div {
    padding: 0px 10px 0px 4px;
    min-height: 142px;
    flex: 3;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    > p:first-child {
      line-height: 1.4;
      color: #1a1a1a;
      margin: 10px 0;
      text-overflow: -o-ellipsis-lastline;
      overflow: hidden;
      text-overflow: ellipsis;
      display: -webkit-box;
      -webkit-line-clamp: 2;
      line-clamp: 2;
      -webkit-box-orient: vertical;
    }
    > div.group-price {
      justify-content: flex-start;
      flex-direction: initial !important;
      > span {
        // background: #fdebeb;
        color: #ff2043;
        padding: 2.5px 8px;
        font-size: 11px;
        border-radius: 3px;
        border: 1px solid #ff2043;
        // width: max-content;
      }
      > span:not(:first-child) {
        margin-left: 6px;
      }
    }
    > div {
      display: flex;
      flex-direction: column;
      > div {
        display: flex;
        justify-content: space-between;
        align-items: flex-end;
        button {
          height: 24px;
          width: 78px;
          background-image: linear-gradient(45deg, #ff3563, #ff7d5e);
          background: linear-gradient(45deg, #ff3563, #ff7d5e) !important;
          border: none !important;
          font-size: 14px;
        }
      }
      > div:first-child {
        > p {
          font-size: 14px;
          color: #000000;
          font-weight: bold;
          span {
            color: #ff2043;
            font-weight: bold;
            small {
              font-size: 12px;
            }
          }
        }
        > span {
          background-image: linear-gradient(45deg, #ff3563, #ff7d5e);
          background: linear-gradient(45deg, #ff3563, #ff7d5e) !important;
          border: none !important;
          font-size: 14px;
          color: #fff;
          border-radius: 15px;
          padding: 3px 15px;
        }
      }
      > div:last-child {
        height: 28px;
        align-items: center;
        font-size: 12px;
        color: #999999;
        > p:last-child {
          font-size: 11px;
          color: #333333;
        }
      }
    }
  }
}
</style>
